//
// Created by 成飞 on 2024/1/13.
//

#ifndef ORDERKV_ORDERKV_W_BUFFER_H
#define ORDERKV_ORDERKV_W_BUFFER_H

#include "buffer.h"
#include "lsm_tree/RecordVal.h"

namespace vstore {
    class OrderkvWBuffer : public WBuffer {
    public:
        std::map<std::string, std::pair<std::string, lsm::LsmRecordVal> > buffer;

    public:
        explicit OrderkvWBuffer();

        //true 新增；false 覆盖
        bool put(std::string& key, std::string& val) override;

        bool put_without_log(std::string& key, std::string& val) override;

        void query(const std::string& key, std::string& val) override;

        void range_query(const string& startKey, const string& endKey, int len, vector<pair<string_view, string_view>>& ret) override;

        //sync?
        void dump() override;

        void ready() override;

    private:
        void init();
    };

}


#endif //ORDERKV_ORDERKV_W_BUFFER_H
